﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using LunchCommand.Data;

namespace LunchCommand.Models.Logging
{
    public class DatabaseLogger : ILogger
    {
        private LogRepository LogRepo { get; set; }

        public DatabaseLogger(LogRepository repo)
        {
            this.LogRepo = repo;
        }

        public void Log(LogEntryType entryType, string message)
        {
            this.LogRepo.SaveLogEntry(new LogEntry()
            {
                Message = message,
                Timestamp = DateTime.Now,
                Type = entryType
            });
        }
    }
}